package Java241121;

class Animal {
    protected String name;
    public Animal (String name){
        this.name= name;
    }
}
interface IFlying{
    void fiy();
}
interface IRunning{
    void run();
}
interface ISwimming{
    void swim();
}
class Cat extends Animal implements IRunning{
    public Cat(String name){
        super(name);
    }
    @Override
    public void run(){
        System.out.println(this.name+"正在用四条腿跑");
    }
}
class Fish extends Animal implements ISwimming{
    public Fish (String name){
        super(name);
    }
    @Override
    public void swim(){
        System.out.println(this.name+"正在用尾巴游泳");
}
}
class Frog extends Animal implements IRunning,ISwimming{
    public Frog(String name){
        super(name);
    }
    @Override
    public void run(){
        System.out.println(this.name+"正在往前跳");
    }
    @Override
    public void swim(){
        System.out.println(this.name+"正在蹬腿游泳");
    }
}
class Duck extends Animal implements IRunning,ISwimming,IFlying{
    public Duck(String name){
        super(name);
    }
    @Override
    public void fiy(){
        System.out.println(this.name+"正在用翅膀飞");
    }
    @Override
    public void run(){
        System.out.println(this.name+"正在用两腿跑");
    }
    @Override
    public void swim(){
        System.out.println(this.name+"正在飘在水上");
    }
}